{
 "metadata": {
  "signature": "sha256:b62e7c954fde60d0173197676fae89694cf86a0474aed81c738bd6d92d9b0093"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Matplotlib: custom log labels\n",
      "======================================================================\n",
      "\n",
      "Example of how to replace the default log-plot exponential labels with\n",
      "integer labels. The same method will work for any kind of custom\n",
      "labeling. This example was pulled from the Python-list mailing list and\n",
      "the original can be found\n",
      "[here](http://mail.python.org/pipermail/python-list/2006-February/369976.html)."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from matplotlib.pyplot import *\n",
      "\n",
      "def log_10_product(x, pos):\n",
      "    \"\"\"The two args are the value and tick position.\n",
      "    Label ticks with the product of the exponentiation\"\"\"\n",
      "    return '%1i' % (x)\n",
      "\n",
      "# Axis scale must be set prior to declaring the Formatter\n",
      "# If it is not the Formatter will use the default log labels for ticks.\n",
      "ax = subplot(111)\n",
      "ax.set_xscale('log')\n",
      "ax.set_yscale('log')\n",
      "\n",
      "formatter = FuncFormatter(log_10_product)\n",
      "ax.xaxis.set_major_formatter(formatter)\n",
      "ax.yaxis.set_major_formatter(formatter)\n",
      "\n",
      "# Create some artificial data.\n",
      "result1 = [3, 5, 70, 700, 900]\n",
      "result2 = [1000, 2000, 3000, 4000, 5000]\n",
      "predict1 = [4, 8, 120, 160, 200]\n",
      "predict2 = [2000, 4000, 6000, 8000, 1000]\n",
      "\n",
      "# Plot\n",
      "ax.scatter(result1, predict1, s=40, c='b', marker='s', faceted=False)\n",
      "ax.scatter(result2, predict2, s=40, c='r', marker='s', faceted=False)\n",
      "\n",
      "ax.set_xlim(1e-1, 1e4)\n",
      "ax.set_ylim(1e-1, 1e4)\n",
      "grid(True)\n",
      "\n",
      "xlabel(r\"Result\", fontsize = 12)\n",
      "ylabel(r\"Prediction\", fontsize = 12)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stderr",
       "text": [
        "/usr/lib/python2.7/dist-packages/matplotlib/cbook.py:137: MatplotlibDeprecationWarning: The faceted option was deprecated in version 1.2. Use edgecolor instead.\n",
        "  warnings.warn(message, mplDeprecation, stacklevel=1)\n"
       ]
      },
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 1,
       "text": [
        "<matplotlib.text.Text at 0x7f07874f2410>"
       ]
      },
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEQCAYAAACugzM1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAFTJJREFUeJzt3X2MbHddx/H3t1wtYC/clpQ2AemqIOXhlqup9jY8LWDB\nWCQFvDwICStpaYhIioSYSmB3LxCIUbMNBCKNFVMgyEOsCEoJ0LEktjTQbItIVEivWGzsE5V7ofLU\nr3/MzN65y+zZ2Z3fnJk55/1KNp1zdjvzO59O97u/33fOOZGZSJK0lZOmPQBJ0myzUEiSKlkoJEmV\nLBSSpEoWCklSJQuFJKlSLYUiIvZHhEVJkubQxH95R8RB4AZgT0TsiYjDEXFRRFweXbveN+mxS5Jg\nz6RfIDNvjIi7gAAuAW7PzGsi4gzgEHDaGPs+OunxS1Lb1b0cdB6w3nt8C3AhcHCMfZKkCZv4jGKT\nM4GjvcdHgTN6j4/tcN+xgX0niAivSSJJPZk59jJ93TOKe4C9vcd7gbt7+07Z4b5TevuGyswiX8vL\ny0V/fqvvD9u/eV/V9laP685gt8dvBqPvb1sGO31fTCqDIr8LYONreeDxuBlU5VFK3YXiWuApvcfn\nAJ8dY9+1W73IysoKnU5n7MEuLi4W/fmtvj9s/+Z9VduDj48cOVI5hp3aSQa7Pf6tvtemDEbd37YM\ndvq+mFQGxX8X7ODf227fsDw6nQ4rKyuVY9iJKFl1hr5AxLlAB3gZ8GngMHArsJ9uYWW3+3LI4CNi\n2O7WWFpa4gMf+MC0hzFVZmAGMIMZbPVBzQn+v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N7j1wLPiYiXAl8CViPi5Ih4cERcFhFnAedl5luBPwMW6c42HtzrV5xF\ntxj0ny84Pov4EfCQiOh/T5opFgppiIh4FvBE4FkRcXZm3gG8EXgf8F/AT4DbgU/2vgDWIuJFdO8i\n9pHMvBP4BHAd3f7FjcD5EfEkup+eelpE/Bzdm8a8AnhhXccn7YT3o5AkVXJGIUmqZKGQJFWyUEiS\nKlkoJEmVLBSSpEoWCklSJQuFJKmShUKSVOn/AXOtJ5P52qTwAAAAAElFTkSuQmCC\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7f0787d83890>"
       ]
      }
     ],
     "prompt_number": 1
    }
   ],
   "metadata": {}
  }
 ]
}